home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / IEEE754.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  75 lines

  1. /* Copyright (C) 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef _IEEE754_H
  20. #define _IEEE754_H
  21.  
  22. #include <endian.h>
  23.  
  24. union ieee754_double
  25.   {
  26.     double d;
  27.     
  28.     /* This is the IEEE 754 double-precision format.  */
  29.     struct
  30.       {
  31. #if    __BYTE_ORDER == __BIG_ENDIAN
  32.     unsigned int negative:1;
  33.     unsigned int exponent:11;
  34.     /* Together these comprise the mantissa.  */
  35.     unsigned int mantissa0:20;
  36.     unsigned int mantissa1:32;
  37. #endif
  38. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  39.     /* Together these comprise the mantissa.  */
  40.     unsigned int mantissa1:32;
  41.     unsigned int mantissa0:20;
  42.     unsigned int exponent:11;
  43.     unsigned int negative:1;
  44. #endif
  45.       } ieee;
  46.     struct
  47.       {
  48. #if    __BYTE_ORDER == __BIG_ENDIAN
  49.     unsigned int negative:1;
  50.     unsigned int exponent:11;
  51.     unsigned int quiet_nan:1;
  52.     /* Together these conprise the mantissa.  */
  53.     unsigned int mantissa0:19;
  54.     unsigned int mantissa1:32;
  55. #else
  56.     /* Together these conprise the mantissa.  */
  57.     unsigned int mantissa1:32;
  58.     unsigned int mantissa0:19;
  59.     unsigned int quiet_nan:1;
  60.     unsigned int exponent:11;
  61.     unsigned int negative:1;
  62. #endif
  63.       } ieee_nan;
  64.   };
  65.  
  66. #define _IEEE754_DOUBLE_BIAS            0x3ff   /* added to exp of ieee754_double */
  67.  
  68. #if defined(__i386__)
  69. # include <i386/ieeefp.h>
  70. #elif defined(__mc68000__)
  71. # include <m68k/ieeefp.h>
  72. #endif
  73.  
  74. #endif    /* _IEEE754_H */
  75.